feat: integrate KYC verification provider with identity provider abstraction#80
Conversation
…raction Adds the first KYC provider (mock-kyc) behind an IIdentityProvider interface, enabling provider-swappable identity verification. - IIdentityProvider abstraction (createSession, getStatus, processWebhook) - MockKycProvider implementation with full state machine - KycModule with POST /kyc/session, GET /kyc/status/:userId, POST /kyc/webhook - kyc_verifications table migration (Supabase/PostgreSQL) - Verification states: pending, in_review, verified, rejected, expired Closes Thalos-Infrastructure#72
|
@Abdul-dev-creator is attempting to deploy a commit to the ManuelJG's projects Team on Vercel. A member of the Team first needs to authorize it. |
Review — changes requested (do not merge yet)Thanks @Abdul-dev-creator — the sketch (abstraction + Nest module + endpoints) is in the right direction for #72. Several blockers before this can land. Blockers
Design / consistency with existing KYB
What looks good
Happy to re-review after migration rename + FK fix + auth on status/webhook + tests. |
…SSoT docs) - Rename migration 002_create_verifications.sql -> 004 to clear the number collision with kyb (002, main), kyc (Thalos-Infrastructure#80) and retry-queue (Thalos-Infrastructure#103) migrations. - Tighten authorization on the compliance endpoints (IDOR fix): reads now require the caller to be the subject (users), an admin, or an internal service. Adds JwtOrInternalSecretGuard (JWT or x-thalos-internal-secret) and VerificationService.assertCanRead; unit tests cover self/admin/internal/denied. - Document the single-source-of-truth model in the README: verifications is a read-only projection that KYC/KYB writers must upsert into, so Thalos-Infrastructure#71/Thalos-Infrastructure#72/Thalos-Infrastructure#75 don't invent another status shape.
|
@Abdul-dev-creator could you please review the comments so we can move on? |
Overview
This PR integrates the first KYC (Know Your Customer) verification provider into the new Identity Provider abstraction. It introduces a provider-swappable IIdentityProvider interface with a mock provider implementation, enabling individual identity verification while exposing a standardized API to the rest of the platform.
Related Issue
Closes #72
Changes
⚙️ Identity Provider Abstraction
[ADD] src/kyc/interfaces/identity-provider.interface.ts
Added the IIdentityProvider interface defining createSession, getStatus, and processWebhook.
Supports provider-swappable architecture — replace the provider implementation without changing business logic.
[ADD] src/kyc/interfaces/kyc.types.ts
Defined the KycStatus enum: pending, in_review, �erified,
ejected, �xpired.
Added shared interfaces for KYC sessions and database rows.
🤖 Mock KYC Provider
🌐 KYC API Surface
[ADD] src/kyc/kyc.controller.ts
POST /kyc/session — Create a new KYC verification session (authenticated).
GET /kyc/status/:userId — Retrieve verification status for a user.
POST /kyc/webhook — Receive verification results from the provider.
[ADD] src/kyc/kyc.service.ts
Orchestrates provider calls and persists verification metadata to Supabase.
Syncs provider-side status with the local database on status checks.
🗄️ Database
🔧 Module Registration
Verification